<template>
<!-- 首页大轮播图 -->
  <div class="banner">
    <el-carousel class="bannerBox" indicator-position="outside" >
      <el-carousel-item  v-for="(list,index) in slideList" :key="index">
        <img :src="list.imgSrc" alt="" style="max-width: 100%;max-height: 100%;">
<!--            <img-->
<!--              style="width:100%; height:100%; display:block;cursor:pointer;"-->
<!--              v-if="list.imgSrc"-->
<!--              :src="list.imgSrc[0]"-->
<!--              :alt="list.title"-->
<!--              @click="goToInfo(list)">-->
            <div class="carousel-title">
              <span>{{list.title}}</span>
            </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import service from '../../utils/request'
export default {
  name: 'FirstRecommend',
  data () {
    return {
      isShow: false, // 控制左右滑动按钮是否显示
      slideList: [],
      currentIndex: 0,
      timer: '',
      url:{
        list:'/sunLunbotu/list',
      },
      preUrl:'http://localhost:8080/jeecg-boot/sys/common/static/'
    }
  },
  created () {
    service.get(this.url.list,{
      params:{
        pageSize:5
      }
    }).then(res=>{
      if (res.data.success){
        let temp = res.data.result.records
        for (let i = 0; i < temp.length; i++) {
          temp[i].imgSrc = this.preUrl+temp[i].imgSrc
        }
        this.slideList = temp
      }
    })

  },
  methods: {
  
  }
}
</script>

<style>
.banner{
    width: 100%;
}
.el-carousel__container {
  height: 450px !important;;
}
.carousel-title span {
  color: white;
  font-size: 22px;
  display: inline-block;
}

@media only screen and (max-width: 1200px) {
  .el-carousel__container {
    height: 360px !important;;
  }
}
  @media only screen and (max-width: 1000px) {
    .el-carousel__container {
      height: 340px !important;;
    }
  }

  @media only screen and (max-width: 960px) {
    .el-carousel__container {
      height: 280px !important;;
    }
  }

  @media only screen and (max-width: 500px) {
    .el-carousel__container {
      height: 200px !important;;
    }
  }

.carousel-title {
  cursor: pointer;
  position: absolute;
  z-index: 10;
  bottom: 40px;
  height: 40px;
  width: 100%;
  line-height: 40px;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
}

.el-carousel__item h3 {
  color: #475669;
  font-size: 18px;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
}

</style>
